<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/8/14 0014
  Time: 上午 11:35
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<div class="body-main">
    <input hidden id="certificateNo" value="${certificateNo}"/>
    <input hidden id="baseId" value="${baseId}"/>
    <table id="subscribetTable" class="cell-border crm-table">
    </table>
</div>
<%--<script src="${pageContext.request.contextPath}/static/js/zzsc/credential/qualification/subscribet.js"></script>--%>
<script>
    $(function () {
        $('#subscribetTable').dataTableExtend({
            "ajax": sysInfo.basePath+"/zzsc/product_reservation/get_product_reservation.do",
            "scrollX":"true",//是否开启横项滚动
            "fnServerParams": function (aoData) {
                //搜索条件
                aoData.certificateNo = $('#certificateNo').val();
            },
            "aoColumns": [
                {
                    "sClass": "check-th",
                    "title":"<input type=\"checkbox\" class=\"checkall\" value=\"undefined\">",
                    "orderable": false,
                    "data": "ID",
                    "render": function (data, type, full, meta) {
                        return '<input type="checkbox"  class="checkchild"  value="' + data + '" />';
                    }
                },
                {
                    "title":"序号",
                    "render": function (data, type, full, meta) {
                        return meta.row+1;
                    }
                },
                {
                    "title":"生产订单编号",
                    "data": "scProductNo",
                    "orderable": false,
                },
                {
                    "title":"状态",
                    "data": "status",
                    "orderable": false
                },
                {
                    "title":"操作",
                    "orderable": false,
                    "data":"id",
                    "render": function (data, type, full, meta) {
                        return'<a onclick="change(\''+full.scProductNo+'\',\''+full.scProductId+'\')" class="iboss-link" style="cursor:pointer">选择</a>';
                    }
                }
            ]
        });
    });
    function change(scProductNo,scProductId) {
        var baseId = $("#baseId").val();
        $.post(sysInfo.basePath+"/zs/credential/qualification/binding_sc.do",{id:baseId,scOrderNo:scProductNo,scOrderId:scProductId},function (ind) {
            if (ind.code == 0) {
                DGG.Succeed("绑定成功！");
            }else {
                DGG.Errors(re.msg);
            }
            layer.closeAll();
            reloadTable();
        })
    }
</script>